import constant.param_config as config
from utils.log_util import prints
from utils.time_util import get_web_server_time
from view.prime_view import PrimeView
from worker.article_worker import ArticleWorker
from worker.calendar_worker import CalendarWorker
from worker.order_worker import OrderWorker
from worker.signal_worker import SignalWorker
from worker.trade_worker import TradeWorker
from worker.statistic_worker import StatisticWorker
from stock.stock_worker import StockWorker
from worker.back_worker import BackWorker
from worker.web_signal import WebSignal

# 仅用于本地
from worker.web_worker import WebWorker
from worker.mt5_worker import MT5Worker
# from worker.simple_worker import SimpleWorker
# from demo.article_worker import ArticleWorker


def authorization():
    limitTime = 1818251720  #2027-08-14 21:55:20
    netTime = get_web_server_time()
    if limitTime > netTime:
        return True
    return False


if __name__ == '__main__':
    if authorization():
        prints("release脚本已启动...")

        # ArticleWorker().startThread()
        # CalendarWorker().startThread()
        # SignalWorker().startThread()
        # TradeWorker().startThread()
        # OrderWorker().startThread()
        # StatisticWorker().startThread()
        # BackWorker().startThread()

        # # 股票
        # StockWorker().startThread()
        # # 挂单策略
        # SimpleWorker().startThread()

        # WebSignal().startThread()
        MT5Worker().startThread()
        WebWorker().startServer()

        # if config.initConfig():
        # PrimeView().show()
    else:
        print("授权已失效")
